//
// Created by dddgzc on 2025/1/23.
//

#include "../include/SceneManager.h"

void SceneManager::setCurrentScene(Scene *scene) {
    scene->onEnter();
    this->currentScene = scene;
}

void SceneManager::switchTo(SceneType sceneType) {
    this->currentScene->onExit();
    switch (sceneType) {
        case SceneType::GameScene:
            setCurrentScene(gameScene);
            break;
        case SceneType::MainMenuScene:
            setCurrentScene(mainMenuScene);
            break;
        case SceneType::PlayerSelectionScene:
            setCurrentScene(playerSelectionScene);
            break;
        default: ;
    }
}

void SceneManager::onDraw(const Camera& camera) const {
    currentScene->onDraw(camera);
}

void SceneManager::onUpdate(int delta) const {
    currentScene->onUpdate(delta);
}

void SceneManager::onInput(const SDL_Event &e) const {
    currentScene->onInput(e);
}
